home *** CD-ROM | disk | FTP | other *** search
-
- // This object moves and renders the marching aliens.
-
- #import <gamekit/gamekit.h>
-
- // size of an alien (info about the .tiff NXImage):
- #define ALIEN_WIDTH 32
- #define ALIEN_HEIGHT 16
- #define ALIEN_WALK_FRAMES 2
- #define ALIEN_DIE_FRAMES 4
- #define ALIEN_FRAMES ALIEN_DIE_FRAMES + ALIEN_WALK_FRAMES
-
- // alien colors (for "series" instance variable)
- #define BLUE_ALIEN 2
- #define GREEN_ALIEN 1
- #define RED_ALIEN 0
-
- // possible states (determine what we can do, etc.)
- #define ALIEN_ALIVE (GK_DEAD_ACTOR + 1)
- #define ALIEN_DEAD GK_DEAD_ACTOR
- #define ALIEN_DYING (GK_DEAD_ACTOR + 2)
-
- @interface NXIAlien:GKActor
- {
- float screenWidth; // set when the stage is assigned
- id overseer;
- }
-
- - init; // Calls method below with semi-sane values...but you should use below:
- - initAlienColor:(int)col at:(NXPoint *)startPos ; // init an alien
- - move:sender; // decide where to move the ghost for the next frame
- - (BOOL)hitEdge:(int)anEdge; // are we to the right/left edge yet?
- - leaveTheStage; // overridden to let the overseer know when we leave
- - collidedWith:anActor; // called when it is detected that we hit something
- - updateDrawingState; // change the internal drawing state machine
-
- @end
-